package org.example;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.lang.reflect.Type;
import java.math.BigDecimal;
import java.util.Arrays;

public class Main {
    public static void main(String[] args) throws InstantiationException, IllegalAccessException, NoSuchMethodException, InvocationTargetException {
        Class c = Student.class;
        Student o = (Student) c.newInstance();
        o.setSum(10);
        Student stu = new Student();
        stu.setSum(11);
        System.out.println(o.compareTo(stu));
        Method test2 = c.getDeclaredMethod("test");

        Type[] type = test2.getGenericParameterTypes(); //  获取方法的所有参数类型的值
        System.out.println(Arrays.toString(type));
        test2.setAccessible(true);  //  暴力使用private修饰的方法
        String invoke = (String) test2.invoke(o);
        System.out.println(invoke);
    }
}